<?php  
class ControllerCommonHome extends Controller {
	public function index() {
		$this->document->setTitle($this->config->get('config_title'));
		$this->document->setDescription($this->config->get('config_meta_description'));

		$this->data['heading_title'] = $this->config->get('config_title');
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/home.tpl';
		} else {
			$this->template = 'default/template/common/home.tpl';
		}
		/*
		$this->children = array(
			'common/column_left',
			'common/column_right',
			'module/mebuu_latest',
			'module/mebuu_about_home',
			'module/mebuu_product_typical',
			'module/mebuu_right_info_home',
			'module/mebuu_right_info_transport_home',
			'module/mebuu_right_info_birthday',
			'module/mebuu_category_home',
			'module/mebuu_consulting_home',
			'module/mebuu_faq_home',
			'module/mebuu_supportonline_home',
			'common/content_top',
			'common/content_bottom',
			'common/footer',
			'common/header'
		);
		*/
		$this->load->model('catalog/information');
		$this->data['banners'] = array();
		//print_r($this->model_catalog_information->getInformations2('banner'));
		
		foreach ($this->model_catalog_information->getInformations2('banner') as $result) {
			/*
			if ($result['image']) {
				$image = HTTP_IMAGE.$result['image'];
				//$image = $this->model_tool_image->resize($result['image'], 671, 293);
			} else {
				$image = false;
			}*/
			if (is_file(DIR_IMAGE . $result['short'])) {
				$image = HTTP_IMAGE.$result['short'];
				//$image = $this->model_tool_image->resize($result['image'], 671, 293);
			} else {
				$image = false;
			}
			if($image) {
			
				$this->data['banners'][] = array(
					'description' => strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'),"<br><b><span>"),
					'link'  => $result['link'],
					'image'  => $image
					
				);
			}
    	}	
		//print_r($this->data['banners']);
		$this->children = array(
			'module/elinea_best_sell',
			'module/elinea_promotion',
			'common/footer',
			'common/header'
		);						
		$this->response->setOutput($this->render());
	}
}
?>